Ext.define('BM.controller.CostItems', {
    extend: 'Ext.app.Controller',
	views:  ['trade.AddCostItem','goods.SelectItem'],
	stores: ['TreeGoods','CostDetails','GoodsItems'],
	models: ['CostDetail','GoodsItem'],
    init: function() {
    
         this.control({
            'addcostitem>panel>panel>panel>textfield':{
            	specialkey:this.onTokenEnterKey
            },
            'addcostitem>panel>panel>tabpanel>treepanel':{
            	itemdblclick:this.onTreeSelectGoods
            },
            'addcostitem>panel>panel>tabpanel>goodsitemlist':{
            	itemdblclick:this.onGridSelectGoods
            }
        });
    },
    onTokenEnterKey:function(_field,_new,_old){
    
    	alert(_field.getValue());
    },
    onTreeSelectGoods:function(view,record,item,index,e){
    	var _tree;
    	if(record.get("leaf")){
    		
    		_tree = Ext.widget('tokentree');
    	}
    },
    onGridSelectGoods:function(view,record,item,index,e){
    	
    }
});